MuhammmadRizwanRizwan commited on
Commit
51ef0ce
·
verified ·
1 Parent(s): 618d870

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoProcessor, AutoModelForSeq2SeqLM
2
+ import gradio as gr
3
+
4
+ # Load model
5
+ processor = AutoProcessor.from_pretrained("Alpha-VLLM/Lumina-mGPT-7B-768")
6
+ model = AutoModelForSeq2SeqLM.from_pretrained("Alpha-VLLM/Lumina-mGPT-7B-768")
7
+
8
+ def generate_text(input_text):
9
+ inputs = processor(input_text, return_tensors="pt")
10
+ outputs = model.generate(**inputs)
11
+ return processor.decode(outputs[0], skip_special_tokens=True)
12
+
13
+ # Gradio Interface
14
+ iface = gr.Interface(
15
+ fn=generate_text,
16
+ inputs=gr.Textbox(label="Input Text"),
17
+ outputs=gr.Textbox(label="Generated Output"),
18
+ title="Lumina mGPT-7B-768",
19
+ description="Enter text to generate output using Lumina-mGPT-7B-768."
20
+ )
21
+
22
+ iface.launch()