Genzo1010 commited on
Commit
79ee170
·
verified ·
1 Parent(s): 89347ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -109,13 +109,33 @@
109
  # import tensorflow as tf
110
  # print("Where tensorflow is built with cuda:",tf.test.is_built_with_cuda())
111
 
112
-
113
  import subprocess
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- # Run nvcc --version and capture the output
116
- nvcc_version = subprocess.check_output(["nvcc", "--version"]).decode("utf-8")
117
 
118
- # Print the output
119
- print("This is the version of Nvcc:" ,nvcc_version)
120
 
121
 
 
109
  # import tensorflow as tf
110
  # print("Where tensorflow is built with cuda:",tf.test.is_built_with_cuda())
111
 
 
112
  import subprocess
113
+ import gradio as gr
114
+
115
+ def get_nvcc_version():
116
+ try:
117
+ nvcc_version = subprocess.check_output(["nvcc", "--version"]).decode("utf-8")
118
+ return "CUDA Version:\n" + nvcc_version
119
+ except FileNotFoundError:
120
+ return "nvcc not found. CUDA may not be installed or not in the system's PATH."
121
+
122
+ def process_ocr(input_image):
123
+ # Example OCR processing logic here
124
+ result = "Processed OCR Result"
125
+
126
+ # Check CUDA status and include it in the output
127
+ cuda_status = get_nvcc_version()
128
+ return f"{result}\n\n{cuda_status}"
129
+
130
+ iface = gr.Interface(
131
+ fn=process_ocr,
132
+ inputs="image",
133
+ outputs="text",
134
+ title="OCR App with CUDA Check",
135
+ description="This app checks if CUDA is available and processes OCR."
136
+ )
137
 
138
+ iface.launch()
 
139
 
 
 
140
 
141