hra commited on
Commit
ffcdd2f
·
1 Parent(s): b73c2dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -40,11 +40,16 @@ with open('lasttechradar.png', 'wb') as handler:
40
  handler.write(img_data)
41
 
42
  def getlastimage():
43
- print('Came into getlastimage')
44
  img_data = requests.get('https://storage.googleapis.com/trends_chrome_extension_bucket/lasttechradar.png').content
45
  with open('lasttechradar1.png', 'wb') as handler:
46
  handler.write(img_data)
47
- return 'lasttechradar1.png'
 
 
 
 
 
48
 
49
 
50
  def getstuff(openapikey):
@@ -207,12 +212,12 @@ with gr.Blocks() as demo:
207
  btn = gr.Button("Refresh")
208
  with gr.Row() as row:
209
  with gr.Column():
210
- output_image = gr.components.Image(label="Tech Radar",value=getlastimage(),every=60)
211
  with gr.Column():
212
- outputMck = gr.Textbox(placeholder=value1, lines=1,label='McKinsey View',every=60)
213
- outputBcg = gr.Textbox(placeholder=value2, lines=1,label='BCG View',every=60)
214
- outputBain = gr.Textbox(placeholder=value3, lines=1,label='Bain View',every=60)
215
- outputAcc = gr.Textbox(placeholder=value4, lines=1,label='Accenture View',every=60)
216
  with gr.Row() as row:
217
  with gr.Column():
218
  outputdesc = gr.Textbox(placeholder=value5, lines=1,label='Description')
@@ -222,6 +227,6 @@ with gr.Blocks() as demo:
222
 
223
  btn.click(getstuff, inputs=[textboxopenapi],outputs=[output_image,outputMck,outputBcg,outputBain,outputAcc,outputdesc,outputclusters])
224
 
225
- demo.load(getlastimage,[],[output_image])
226
 
227
- demo.queue().launch(debug=True)
 
40
  handler.write(img_data)
41
 
42
  def getlastimage():
43
+ #print('Came into getlastimage')
44
  img_data = requests.get('https://storage.googleapis.com/trends_chrome_extension_bucket/lasttechradar.png').content
45
  with open('lasttechradar1.png', 'wb') as handler:
46
  handler.write(img_data)
47
+
48
+ with fs.open('trends_chrome_extension_bucket/lastradartext.txt', 'rb') as file:
49
+ data_old = file.read()
50
+ #print(data_old)
51
+ value1,value2,value3,value4,value5,value6=str(data_old.decode()).split('SEPERATOR')
52
+ return 'lasttechradar1.png',value1,value2,value3,value4,value5,value6
53
 
54
 
55
  def getstuff(openapikey):
 
212
  btn = gr.Button("Refresh")
213
  with gr.Row() as row:
214
  with gr.Column():
215
+ output_image = gr.components.Image(label="Tech Radar",value='lasttechradar.png')
216
  with gr.Column():
217
+ outputMck = gr.Textbox(placeholder=value1, lines=1,label='McKinsey View')
218
+ outputBcg = gr.Textbox(placeholder=value2, lines=1,label='BCG View')
219
+ outputBain = gr.Textbox(placeholder=value3, lines=1,label='Bain View')
220
+ outputAcc = gr.Textbox(placeholder=value4, lines=1,label='Accenture View')
221
  with gr.Row() as row:
222
  with gr.Column():
223
  outputdesc = gr.Textbox(placeholder=value5, lines=1,label='Description')
 
227
 
228
  btn.click(getstuff, inputs=[textboxopenapi],outputs=[output_image,outputMck,outputBcg,outputBain,outputAcc,outputdesc,outputclusters])
229
 
230
+ demo.load(getlastimage,[],[output_image,outputMck,outputBcg,outputBain,outputAcc,outputdesc,outputclusters])
231
 
232
+ demo.launch(debug=True)