dharma03 commited on
Commit
bec8ff3
1 Parent(s): 47c3719

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
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()