OuroborosM commited on
Commit
4928a16
·
1 Parent(s): 3b29a44

first codeinterpret

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -86,6 +86,25 @@ import re
86
 
87
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
88
  import torch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
91
  sample = ds[0]["audio"]
@@ -1329,7 +1348,7 @@ def clearall():
1329
  global Filename_Chatbot
1330
  Filename_Chatbot = []
1331
  with open("output.log", "w") as file:
1332
- file.write("")
1333
  return [[], gr.update(visible=True), gr.update(visible=False), []]
1334
 
1335
  def retry(history3):
@@ -1718,6 +1737,8 @@ if __name__ == '__main__':
1718
  # QAQuery_p("what is PDP ?")
1719
  # question = "what is PDP?"
1720
  # output = asyncio.run(start_playwright(question))
 
 
1721
 
1722
  if SysLock == "1":
1723
  demo.queue(concurrency_count=3).launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)
 
86
 
87
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
88
  import torch
89
+ from codeinterpreterapi import CodeInterpreterSession
90
+
91
+
92
+ async def TestCodeInterpret(CustomMessage:str):
93
+ # create a session
94
+ session = CodeInterpreterSession(llm=GPTfake)
95
+ session.start()
96
+
97
+ # generate a response based on user input
98
+ response = await session.generate_response(CustomMessage)
99
+
100
+ # output the response (text + image)
101
+ print("AI: ", response.content)
102
+ for file in response.files:
103
+ file.show_image()
104
+
105
+ # terminate the session
106
+ session.stop()
107
+
108
 
109
  ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
110
  sample = ds[0]["audio"]
 
1348
  global Filename_Chatbot
1349
  Filename_Chatbot = []
1350
  with open("output.log", "w") as file:
1351
+ file.truncate(0)
1352
  return [[], gr.update(visible=True), gr.update(visible=False), []]
1353
 
1354
  def retry(history3):
 
1737
  # QAQuery_p("what is PDP ?")
1738
  # question = "what is PDP?"
1739
  # output = asyncio.run(start_playwright(question))
1740
+
1741
+ asyncio.run(TestCodeInterpret('Plot the bitcoin chart of 2023 YTD'))
1742
 
1743
  if SysLock == "1":
1744
  demo.queue(concurrency_count=3).launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)