OuroborosM commited on
Commit
d421a6e
·
1 Parent(s): 6a0d0d0

add log function

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -22,7 +22,7 @@ from langchain.agents import ZeroShotAgent, AgentExecutor
22
  from langchain import LLMChain
23
  import azure.cognitiveservices.speech as speechsdk
24
  import requests
25
-
26
  import pinecone
27
  from pinecone.core.client.configuration import Configuration as OpenApiConfiguration
28
  import gradio as gr
@@ -519,16 +519,27 @@ def func_upload_file(files, chat_history):
519
  chat_history.append(test_msg)
520
  yield chat_history
521
 
 
 
 
 
 
522
  with gr.Blocks() as demo:
523
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
524
- main = gr.ChatInterface(
525
- chathmi2,
526
- title="STLA BABY - YOUR FRIENDLY GUIDE",
527
- description= "v0.3: Powered by MECH Core Team",
528
- )
 
 
529
  upload_button = gr.UploadButton("Upload File", file_count="multiple")
530
  upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
531
-
 
 
 
 
532
  # demo = gr.Interface(
533
  # chathmi,
534
  # ["text", "state"],
 
22
  from langchain import LLMChain
23
  import azure.cognitiveservices.speech as speechsdk
24
  import requests
25
+ import sys
26
  import pinecone
27
  from pinecone.core.client.configuration import Configuration as OpenApiConfiguration
28
  import gradio as gr
 
519
  chat_history.append(test_msg)
520
  yield chat_history
521
 
522
+ def read_logs():
523
+ sys.stdout.flush()
524
+ with open("output.log", "r") as f:
525
+ return f.read()
526
+
527
  with gr.Blocks() as demo:
528
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
529
+ with gr.Row():
530
+ main = gr.ChatInterface(
531
+ chathmi2,
532
+ title="STLA BABY - YOUR FRIENDLY GUIDE",
533
+ description= "v0.3: Powered by MECH Core Team",
534
+ )
535
+ logs = gr.Textbox()
536
  upload_button = gr.UploadButton("Upload File", file_count="multiple")
537
  upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
538
+ demo.load(read_logs, None, logs, every=2)
539
+
540
+
541
+
542
+
543
  # demo = gr.Interface(
544
  # chathmi,
545
  # ["text", "state"],