Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -150,13 +150,20 @@ def loop_function(df):
|
|
| 150 |
except Exception as e:
|
| 151 |
print(f"Error: {e} - skipping row")
|
| 152 |
continue
|
| 153 |
-
|
|
|
|
|
|
|
| 154 |
def check_compliance(file): # FIXED: now streams
|
| 155 |
if file.name.endswith(".docx"):
|
| 156 |
df1 = extract_docx_text(file.name)
|
| 157 |
yield from loop_function(df1) # FIXED: delegate yields
|
| 158 |
else:
|
| 159 |
yield "Unsupported file format"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
#================================================Gradio==================
|
| 161 |
|
| 162 |
css = """
|
|
@@ -202,8 +209,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 202 |
with gr.TabItem("Compliance Check of user technical doc"):
|
| 203 |
with gr.Row():
|
| 204 |
inp_tech = gr.File(
|
| 205 |
-
label="Upload Admin File in word i.e.
|
| 206 |
-
file_types=[".
|
| 207 |
elem_id="admin-file"
|
| 208 |
)
|
| 209 |
run_btn_tech = gr.Button("Check compliance", elem_id="compliance-btn-tech")
|
|
|
|
| 150 |
except Exception as e:
|
| 151 |
print(f"Error: {e} - skipping row")
|
| 152 |
continue
|
| 153 |
+
def loop_function_tech(df):
|
| 154 |
+
#to be prepared
|
| 155 |
+
yield "coming soon"
|
| 156 |
def check_compliance(file): # FIXED: now streams
|
| 157 |
if file.name.endswith(".docx"):
|
| 158 |
df1 = extract_docx_text(file.name)
|
| 159 |
yield from loop_function(df1) # FIXED: delegate yields
|
| 160 |
else:
|
| 161 |
yield "Unsupported file format"
|
| 162 |
+
def check_compliance_tech(file):
|
| 163 |
+
if file.name.endswith(".pdf"):
|
| 164 |
+
yield "Coming Soon"
|
| 165 |
+
else:
|
| 166 |
+
yield "Unsupported file format"
|
| 167 |
#================================================Gradio==================
|
| 168 |
|
| 169 |
css = """
|
|
|
|
| 209 |
with gr.TabItem("Compliance Check of user technical doc"):
|
| 210 |
with gr.Row():
|
| 211 |
inp_tech = gr.File(
|
| 212 |
+
label="Upload Admin File in word i.e. pdf format",
|
| 213 |
+
file_types=[".pdf"],
|
| 214 |
elem_id="admin-file"
|
| 215 |
)
|
| 216 |
run_btn_tech = gr.Button("Check compliance", elem_id="compliance-btn-tech")
|