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

chore: Update app.py and requirements.txt

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -40,17 +40,24 @@ 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__(
 
40
 
41
  import gradio as gr
42
  import gradio_client
 
 
 
43
  import subprocess
44
  import sys
45
 
46
+ def install_gradio_4_35_0():
47
+ current_version = gr.__version__
48
+ if current_version != "4.35.0":
49
+ print(f"Current Gradio version: {current_version}")
50
+ print("Installing Gradio 4.35.0...")
51
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==4.35.0", "--force-reinstall"])
52
+ print("Gradio 4.35.0 installed successfully.")
53
+ else:
54
+ print("Gradio 4.35.0 is already installed.")
55
 
56
+ # Call the function to install Gradio 4.35.0 if needed
57
+ install_gradio_4_35_0()
58
+
59
+ print(f"Gradio version: {gr.__version__}")
60
+ print(f"Gradio-client version: {gradio_client.__version__}")
61
 
62
  class InferenceDemo(object):
63
  def __init__(