adding source code
Browse files- app.py +27 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""app.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/19167B_f_iSL9n-syr-urLCEIq5RZFmcZ
|
8 |
+
"""
|
9 |
+
|
10 |
+
!pip install gradio
|
11 |
+
|
12 |
+
!pip install transformers
|
13 |
+
|
14 |
+
from transformers import pipeline, set_seed
|
15 |
+
|
16 |
+
generator = pipeline('text-generation', model='gpt2')
|
17 |
+
|
18 |
+
import gradio as gr
|
19 |
+
def func(text):
|
20 |
+
generated = generator(text)
|
21 |
+
return generated
|
22 |
+
|
23 |
+
app = gr.Interface(fn=func, inputs="textbox", outputs="textbox", title="Text Generator")
|
24 |
+
app.launch()
|
25 |
+
|
26 |
+
|
27 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
gradio
|
3 |
+
torch
|