slush0 commited on
Commit
d17e7da
·
1 Parent(s): 970d5ef

Layout preparation for prompt mode and chat mode.

Browse files
Files changed (2) hide show
  1. app.py +20 -0
  2. prompt.py +2 -14
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from prompt import iface_prompt
4
+
5
+ with gr.Blocks() as iface:
6
+ gr.Markdown("""# Petals playground
7
+ **Let's play with prompts and inference settings for BLOOM and BLOOMZ 176B models!**
8
+
9
+ This space uses websocket API of [chat.petals.ml](http://chat.petals.ml). Health status of Petals network [lives here](http://health.petals.ml).
10
+
11
+ Do NOT talk to BLOOM as an entity, it's not a chatbot but a webpage/blog/article completion model.
12
+ For the best results: MIMIC a few sentences of a webpage similar to the content you want to generate.
13
+
14
+ BLOOMZ performs better in chat mode and understands the instructions better.""")
15
+
16
+ gr.TabbedInterface([iface_prompt, ], ["Prompt mode",])
17
+
18
+ # Queues are required to enable generators
19
+ iface.queue(concurrency_count=5)
20
+ iface.launch()
prompt.py CHANGED
@@ -70,16 +70,8 @@ def generate(prompt, model, endseq, max_length,
70
  yield [prompt, output + "\nError: " + traceback.format_exc()]
71
  return
72
 
73
- with gr.Blocks() as iface:
74
- gr.Markdown("""# Petals playground
75
- **Let's play with prompts and inference settings for BLOOM and BLOOMZ 176B models!**
76
-
77
- This space uses websocket API of [chat.petals.ml](http://chat.petals.ml). Health status of Petals network [lives here](http://health.petals.ml).
78
-
79
- Do NOT talk to BLOOM as an entity, it's not a chatbot but a webpage/blog/article completion model.
80
- For the best results: MIMIC a few sentences of a webpage similar to the content you want to generate.
81
-
82
- BLOOMZ performs better in chat mode and understands the instructions better.""")
83
 
84
  with gr.Row():
85
  model = gr.Radio(["bloom", "bloomz", "bloom-7b1"], value='bloom', label="Use model")
@@ -131,7 +123,3 @@ with gr.Blocks() as iface:
131
  "Human: What's the capital of Portugal?</s>\n"
132
  "AI: ", "bloomz", True, 0, 0.9, 0.75, False]
133
  ])
134
-
135
- # Queues are required to enable generators
136
- iface.queue(concurrency_count=5)
137
- iface.launch()
 
70
  yield [prompt, output + "\nError: " + traceback.format_exc()]
71
  return
72
 
73
+ with gr.Blocks() as iface_prompt:
74
+ gr.Markdown("""**Useful for testing raw prompts with zero, one or few-shot prompting.**""")
 
 
 
 
 
 
 
 
75
 
76
  with gr.Row():
77
  model = gr.Radio(["bloom", "bloomz", "bloom-7b1"], value='bloom', label="Use model")
 
123
  "Human: What's the capital of Portugal?</s>\n"
124
  "AI: ", "bloomz", True, 0, 0.9, 0.75, False]
125
  ])