anandaa commited on
Commit
aa5f44e
β€’
1 Parent(s): 4653a36

trying to commit something

Browse files
Files changed (2) hide show
  1. app.py +36 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from webapp import webapp
3
+
4
+ def add_text(history, text):
5
+ history = history + [[text, None]]
6
+ return history, gr.update(value="", interactive=False)
7
+
8
+ def process_input(history):
9
+ inp = history[-1][0]
10
+ response = "I have received your input, which is: \n" + inp
11
+ history[-1][1] = response
12
+ return history
13
+
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown('''
16
+ ## **CareerPal**
17
+ here to ease your anxiety about your future
18
+ ''')
19
+ with gr.Row():
20
+ output_box = gr.Chatbot([[None, "Welcome! What can I help you with today?"]], show_label=False).style(height=450)
21
+ with gr.Row(): # TODO: Box or Group instead of row?
22
+ with gr.Column(scale=7):
23
+ input_box = gr.Textbox(show_label=False, placeholder="Ask something here and press enter...").style(container=False)
24
+ with gr.Column(scale=1):
25
+ clear_btn = gr.Button(value="Clear")
26
+
27
+ txt_msg = input_box.submit(add_text, inputs=[output_box, input_box], outputs=[output_box, input_box],
28
+ queue=False).then(process_input, output_box, output_box)
29
+ txt_msg.then(lambda: gr.update(interactive=True), inputs=None, outputs=input_box, queue=False)
30
+
31
+ clear_btn.click(lambda: None, inputs=None, outputs=output_box, queue=False)
32
+
33
+ demo.launch(server_port=7860, show_api=False, share=False) # , share = True, inline = True)
34
+
35
+ # set FLASK_APP=app.py
36
+ # flask run -h localhost -p 7860
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ flask
2
+ gradio
3
+ torch
4
+ transformers
5
+ langchain