luodian commited on
Commit
71e6b18
1 Parent(s): 05d4795

chore: Update app.py and requirements.txt

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -38,6 +38,19 @@ from PIL import Image
38
  from io import BytesIO
39
  from transformers import TextStreamer
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  class InferenceDemo(object):
43
  def __init__(
@@ -414,6 +427,7 @@ with gr.Blocks(
414
 
415
 
416
  demo.queue()
 
417
  if __name__ == "__main__":
418
  import argparse
419
 
@@ -435,11 +449,6 @@ if __name__ == "__main__":
435
  argparser.add_argument("--debug", action="store_true")
436
 
437
  args = argparser.parse_args()
438
- import gradio as gr
439
- import gradio_client
440
-
441
- print(f"Gradio version: {gr.__version__}")
442
- print(f"Gradio-client version: {gradio_client.__version__}")
443
 
444
  model_path = args.model_path
445
  filt_invalid = "cut"
 
38
  from io import BytesIO
39
  from transformers import TextStreamer
40
 
41
+ import gradio as gr
42
+ import gradio_client
43
+
44
+ print(f"Gradio version: {gr.__version__}")
45
+ print(f"Gradio-client version: {gradio_client.__version__}")
46
+ import subprocess
47
+ import sys
48
+
49
+ def install_gradio():
50
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==4.35.0", "--force-reinstall"])
51
+
52
+ # Call the function to install Gradio
53
+ install_gradio()
54
 
55
  class InferenceDemo(object):
56
  def __init__(
 
427
 
428
 
429
  demo.queue()
430
+
431
  if __name__ == "__main__":
432
  import argparse
433
 
 
449
  argparser.add_argument("--debug", action="store_true")
450
 
451
  args = argparser.parse_args()
 
 
 
 
 
452
 
453
  model_path = args.model_path
454
  filt_invalid = "cut"