lordspline commited on
Commit
323c7ea
1 Parent(s): 5a57f54

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +34 -26
app.py CHANGED
@@ -8,10 +8,10 @@ image_temp = "https://miro.medium.com/v2/resize:fit:1200/0*n-2bW82Z6m6U2bij.jpeg
8
  # editor_image=image_temp, browser_image=image_temp, scratchpad_image=image_temp
9
  # )
10
  devon = None
11
- multion_api_key = ""
12
- openai_api_key = ""
13
- replit_email = ""
14
- replit_password = ""
15
 
16
 
17
  def add_message(history, message):
@@ -22,36 +22,38 @@ def add_message(history, message):
22
  return history, gr.MultimodalTextbox(value=None, interactive=False)
23
 
24
 
25
- def multion_api_key_update(x):
26
- global multion_api_key
27
- multion_api_key = x
28
 
29
 
30
- def openai_api_key_update(x):
31
- global openai_api_key
32
- openai_api_key = x
33
 
34
 
35
- def replit_email_update(x):
36
- global replit_email
37
- replit_email = x
38
 
39
 
40
- def replit_password_update(x):
41
- global replit_password
42
- replit_password = x
43
 
44
 
45
- def bot(history):
 
 
46
  start_time = time.time()
47
  devon = DevOn(
48
  editor_image=image_temp,
49
  browser_image=image_temp,
50
  scratchpad_image=image_temp,
51
- multion_api_key=multion_api_key,
52
- openai_api_key=openai_api_key,
53
- replit_email=replit_email,
54
- replit_password=replit_password,
55
  )
56
 
57
  for r in devon.run(history[-1][0]):
@@ -124,16 +126,22 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
124
  )
125
  bot_msg = chat_msg.then(
126
  bot,
127
- [chatbot],
 
 
 
 
 
 
128
  [chatbot, editor_view, browser_view, scratchpad_view],
129
  api_name="bot_response",
130
  )
131
  bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
132
 
133
- multion_api_key_in.change(multion_api_key_update, multion_api_key_in)
134
- openai_api_key_in.change(openai_api_key_update, openai_api_key_in)
135
- replit_email_in.change(replit_email_update, replit_email_in)
136
- replit_password_in.change(replit_password_update, replit_password_in)
137
 
138
  terminate.click(fn=None, inputs=None, outputs=None, cancels=[bot_msg])
139
 
 
8
  # editor_image=image_temp, browser_image=image_temp, scratchpad_image=image_temp
9
  # )
10
  devon = None
11
+ # multion_api_key = ""
12
+ # openai_api_key = ""
13
+ # replit_email = ""
14
+ # replit_password = ""
15
 
16
 
17
  def add_message(history, message):
 
22
  return history, gr.MultimodalTextbox(value=None, interactive=False)
23
 
24
 
25
+ # def multion_api_key_update(x):
26
+ # # global multion_api_key
27
+ # multion_api_key = x
28
 
29
 
30
+ # def openai_api_key_update(x):
31
+ # # global openai_api_key
32
+ # openai_api_key = x
33
 
34
 
35
+ # def replit_email_update(x):
36
+ # # global replit_email
37
+ # replit_email = x
38
 
39
 
40
+ # def replit_password_update(x):
41
+ # # global replit_password
42
+ # replit_password = x
43
 
44
 
45
+ def bot(
46
+ history, multion_api_key_in, openai_api_key_in, replit_email_in, replit_password_in
47
+ ):
48
  start_time = time.time()
49
  devon = DevOn(
50
  editor_image=image_temp,
51
  browser_image=image_temp,
52
  scratchpad_image=image_temp,
53
+ multion_api_key=multion_api_key_in,
54
+ openai_api_key=openai_api_key_in,
55
+ replit_email=replit_email_in,
56
+ replit_password=replit_password_in,
57
  )
58
 
59
  for r in devon.run(history[-1][0]):
 
126
  )
127
  bot_msg = chat_msg.then(
128
  bot,
129
+ [
130
+ chatbot,
131
+ multion_api_key_in,
132
+ openai_api_key_in,
133
+ replit_email_in,
134
+ replit_password_in,
135
+ ],
136
  [chatbot, editor_view, browser_view, scratchpad_view],
137
  api_name="bot_response",
138
  )
139
  bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
140
 
141
+ # multion_api_key_in.change(multion_api_key_update, multion_api_key_in)
142
+ # openai_api_key_in.change(openai_api_key_update, openai_api_key_in)
143
+ # replit_email_in.change(replit_email_update, replit_email_in)
144
+ # replit_password_in.change(replit_password_update, replit_password_in)
145
 
146
  terminate.click(fn=None, inputs=None, outputs=None, cancels=[bot_msg])
147