Dawoodthouseef commited on
Commit
813a71e
·
1 Parent(s): 16af54d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -10
app.py CHANGED
@@ -14,7 +14,7 @@ If a question does not make any sense, or is not factually coherent, explain why
14
 
15
  # Define the conversation history
16
  conversation_history = []
17
-
18
 
19
  def generate_response(input_text):
20
  global conversation_history
@@ -26,12 +26,29 @@ def generate_response(input_text):
26
 
27
  return response_text
28
  # Create a Gradio interface
29
- gr.Interface(
30
- fn=generate_response,
31
- inputs=gr.Textbox(placeholder="Type a message..."),
32
- outputs=gr.Textbox(" "),
33
- live=True,
34
- layout="vertical",
35
- title="MISTGPT",
36
- theme="huggingface",
37
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  # Define the conversation history
16
  conversation_history = []
17
+ css = ".generating {visibility: hidden}"
18
 
19
  def generate_response(input_text):
20
  global conversation_history
 
26
 
27
  return response_text
28
  # Create a Gradio interface
29
+ with gr.Blocks(analytics_enabled=False, css=css) as demo:
30
+ with gr.Column():
31
+ gr.Markdown(
32
+ """ ## Mistral-7b Version-2.0
33
+
34
+ Type in the box below and click the button to generate answers to your most pressing questions!
35
+
36
+ """
37
+ )
38
+
39
+ with gr.Row():
40
+
41
+ with gr.Column(scale=3):
42
+ instruction = gr.Textbox(placeholder="Enter your question here", label="Question", elem_id="q-input")
43
+
44
+ with gr.Box():
45
+ gr.Markdown("**Answer**")
46
+ output = gr.Markdown(elem_id="q-output")
47
+ submit = gr.Button("Generate", variant="primary")
48
+
49
+
50
+
51
+ submit.click(generate_response, inputs=[instruction], outputs=[output])
52
+ instruction.submit(generate_response, inputs=[instruction], outputs=[output])
53
+
54
+ demo.queue(concurrency_count=1).launch(debug=False,share=True)