modelpretrained / app.py
dharma03's picture
Create app.py
bec8ff3 verified
raw
history blame contribute delete
362 Bytes
import gradio as gr
from transformers import pipeline
model_name = "MaziyarPanahi/Mistral-7B-Alpaca-52k-v0.2"
pipe = pipeline("text-generation", model=model_name)
def generate_text(prompt):
response = pipe(prompt, max_length=50)
return response[0]['generated_text']
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
iface.launch()