Martin van Dijk
commited on
Commit
·
808c7ef
1
Parent(s):
40c4dc0
Update space
Browse files
app.py
CHANGED
|
@@ -1,19 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
"""
|
| 4 |
-
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 5 |
-
"""
|
| 6 |
|
| 7 |
-
model =
|
| 8 |
|
| 9 |
|
| 10 |
def predict(prompt):
|
| 11 |
completion = model(prompt)[0]["generated_text"]
|
| 12 |
return completion
|
| 13 |
|
|
|
|
| 14 |
|
| 15 |
-
"""
|
| 16 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 17 |
-
"""
|
| 18 |
-
demo = gr.Interface(fn=predict, inputs="text", outputs="text").launch()
|
| 19 |
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
model = pipeline("text-generation")
|
| 5 |
|
| 6 |
|
| 7 |
def predict(prompt):
|
| 8 |
completion = model(prompt)[0]["generated_text"]
|
| 9 |
return completion
|
| 10 |
|
| 11 |
+
import gradio as gr
|
| 12 |
|
| 13 |
+
gr.Interface(fn=predict, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|
|
|
| 14 |
|