Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
model_output_path='./output'
|
| 4 |
+
my_model = GPT2LMHeadModel.from_pretrained(model_output_path)
|
| 5 |
+
my_tokenizer = GPT2Tokenizer.from_pretrained(model_output_path)
|
| 6 |
+
|
| 7 |
+
def predict(prompt):
|
| 8 |
+
response = generate_response(my_model, my_tokenizer, prompt)
|
| 9 |
+
return response
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 12 |
+
iface.launch()
|
| 13 |
+
|