Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation", model="yentinglin/Taiwan-LLM-7B-v2.0.1-chat")
|
| 5 |
+
|
| 6 |
+
def chat_fn(prompt):
|
| 7 |
+
return pipe(prompt, max_new_tokens=200)[0]["generated_text"]
|
| 8 |
+
|
| 9 |
+
iface = gr.Interface(fn=chat_fn, inputs="text", outputs="text")
|
| 10 |
+
iface.launch()
|