Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model_name = "MaziyarPanahi/Mistral-7B-Alpaca-52k-v0.2"
|
5 |
+
pipe = pipeline("text-generation", model=model_name)
|
6 |
+
|
7 |
+
def generate_text(prompt):
|
8 |
+
response = pipe(prompt, max_length=50)
|
9 |
+
return response[0]['generated_text']
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|
12 |
+
iface.launch()
|