Spaces:
Paused
Paused
RashiAgarwal
commited on
Commit
·
5e2e076
1
Parent(s):
77dfb9a
Update app.py
Browse files
app.py
CHANGED
@@ -25,18 +25,25 @@ def inference(prompt):
|
|
25 |
pipe = pipeline(task="text-generation",model=model,tokenizer=tokenizer,max_length=200)
|
26 |
result = pipe(f"<s>[INST] {prompt} [/INST]")
|
27 |
return result[0]['generated_text']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
with gr.Blocks() as demo:
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
demo.launch(debug=True)
|
|
|
25 |
pipe = pipeline(task="text-generation",model=model,tokenizer=tokenizer,max_length=200)
|
26 |
result = pipe(f"<s>[INST] {prompt} [/INST]")
|
27 |
return result[0]['generated_text']
|
28 |
+
|
29 |
+
INTERFACE = gr.Interface(fn=inference, inputs=[gr.Textbox(label= "Prompt", value= 'Please write about Shakuntala Devi'),
|
30 |
+
|
31 |
+
outputs=gr.Text(label= "Generated Text"), title="Phi-2 fine-tuned with OpenAssistant/oasst-1 dataset using QLoRA strategy",
|
32 |
+
|
33 |
+
examples = [['Write a note on Indiana Jones],]
|
34 |
+
).launch(debug=True)
|
35 |
|
36 |
+
# with gr.Blocks() as demo:
|
37 |
+
|
38 |
+
# gr.Markdown(
|
39 |
+
# """
|
40 |
+
# # Phi2 trained on OpenAssistant/oasst1 dataset
|
41 |
+
# Start typing below to see the output.
|
42 |
+
# """)
|
43 |
+
# prompt = gr.Textbox(label="Prompt")
|
44 |
+
# output = gr.Textbox(label="Output Box")
|
45 |
+
# greet_btn = gr.Button("Generate")
|
46 |
+
# examples = gr.Examples(examples=[[prompt = 'Please write about Shakuntala Devi'], [prompt = 'Write a brief note on Indiana Jones']], cache_examples=False)
|
47 |
+
# greet_btn.click(fn=inference, inputs=prompt, outputs=output)
|
48 |
+
|
49 |
+
# demo.launch(debug=True)
|