Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
pipe = pipeline("chat", model="huggingface-projects/llama-2-7b-chat")
|
| 6 |
+
|
| 7 |
+
def predict(text):
|
| 8 |
+
return pipe(text)[0]["text"]
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(
|
| 11 |
+
fn=predict,
|
| 12 |
+
inputs='text',
|
| 13 |
+
outputs='text',
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
demo.launch()
|