sailfish commited on
Commit
00cdb9a
1 Parent(s): 7d6bd00
Files changed (1) hide show
  1. app.py +28 -3
app.py CHANGED
@@ -31,8 +31,7 @@ def generate_text(
31
  system_message,
32
  max_tokens,
33
  temperature,
34
- top_p,
35
- do_sample
36
  ):
37
  try:
38
  print(f"Attempting to generate text for prompt: {prompt[:50]}...")
@@ -89,7 +88,7 @@ def respond(
89
 
90
  """
91
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
92
- """
93
  demo = gr.ChatInterface(
94
  #respond,
95
  generate_text,
@@ -106,6 +105,32 @@ demo = gr.ChatInterface(
106
  ),
107
  ],
108
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
 
111
  if __name__ == "__main__":
 
31
  system_message,
32
  max_tokens,
33
  temperature,
34
+ top_p
 
35
  ):
36
  try:
37
  print(f"Attempting to generate text for prompt: {prompt[:50]}...")
 
88
 
89
  """
90
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
91
+
92
  demo = gr.ChatInterface(
93
  #respond,
94
  generate_text,
 
105
  ),
106
  ],
107
  )
108
+ """
109
+
110
+ with gr.Tab("Generate Email"):
111
+ Query = gr.Textbox(label="Query")
112
+ generate_button = gr.Button("Ask Query")
113
+ output = gr.Textbox(label="Generated Answer", lines=10)
114
+
115
+ generate_button.click(generate_text,
116
+ #inputs=[industry, recipient_role, company_details],
117
+ additional_inputs=[
118
+ Query,
119
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
120
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
121
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
122
+ gr.Slider(
123
+ minimum=0.1,
124
+ maximum=1.0,
125
+ value=0.95,
126
+ step=0.05,
127
+ label="Top-p (nucleus sampling)",
128
+ ),
129
+ ],
130
+
131
+
132
+ outputs=output)
133
+
134
 
135
 
136
  if __name__ == "__main__":