RamAnanth1 commited on
Commit
9b1ec5f
·
1 Parent(s): 69b97b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from pyChatGPT import ChatGPT
2
  import gradio as gr
3
  import os, json
4
  from loguru import logger
@@ -6,8 +6,7 @@ import random
6
  from transformers import pipeline
7
  import torch
8
 
9
- session_token = os.environ.get('SessionToken')
10
- api = ChatGPT(session_token)
11
 
12
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
13
 
@@ -133,10 +132,8 @@ start_work = """async() => {
133
  }"""
134
 
135
 
136
- with gr.Blocks(title='Talk to chatGPT') as demo:
137
- gr.Markdown("## Talk to chatGPT with your voice in your native language ! ##")
138
- gr.HTML("<p>You can duplicate this space and use your own session token: <a style='display:inline-block' href='https://huggingface.co/spaces/yizhangliu/chatGPT?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14' alt='Duplicate Space'></a></p>")
139
- gr.HTML("<p> Instruction on how to get session token can be seen in video <a style='display:inline-block' href='https://www.youtube.com/watch?v=TdNSj_qgdFk'><font style='color:blue;weight:bold;'>here</font></a>. Add your session token by going to settings and add under secrets. </p>")
140
  with gr.Group(elem_id="page_1", visible=True) as page_1:
141
  with gr.Box():
142
  with gr.Row():
@@ -160,7 +157,7 @@ with gr.Blocks(title='Talk to chatGPT') as demo:
160
  with gr.Row(elem_id="prompt_row"):
161
  prompt_input = gr.Textbox(lines=2, label="Input text",show_label=True)
162
  chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
163
- submit_btn = gr.Button(value = "Send to chatGPT",elem_id="submit-btn").style(
164
  margin=True,
165
  rounded=(True, True, True, True),
166
  width=100
@@ -186,6 +183,6 @@ with gr.Blocks(title='Talk to chatGPT') as demo:
186
  </p>
187
  </div>
188
  ''')
189
- gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=RamAnanth1.chatGPT_voice)")
190
 
191
  demo.launch(debug = True)
 
1
+ import cohere
2
  import gradio as gr
3
  import os, json
4
  from loguru import logger
 
6
  from transformers import pipeline
7
  import torch
8
 
9
+ co = cohere.Client(os.environ.get('COHERE_API_KEY'))
 
10
 
11
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
12
 
 
132
  }"""
133
 
134
 
135
+ with gr.Blocks(title='Talk to catGPT') as demo:
136
+ gr.Markdown("## Talk to catGPT with your voice in your native language ! ##")
 
 
137
  with gr.Group(elem_id="page_1", visible=True) as page_1:
138
  with gr.Box():
139
  with gr.Row():
 
157
  with gr.Row(elem_id="prompt_row"):
158
  prompt_input = gr.Textbox(lines=2, label="Input text",show_label=True)
159
  chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
160
+ submit_btn = gr.Button(value = "Send to catgpt",elem_id="submit-btn").style(
161
  margin=True,
162
  rounded=(True, True, True, True),
163
  width=100
 
183
  </p>
184
  </div>
185
  ''')
186
+ #gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=RamAnanth1.chatGPT_voice)")
187
 
188
  demo.launch(debug = True)