updated app.py to show live outputs and updated gitignore to ignore excel and doc files
Browse files- .gitignore +4 -0
- app.py +3 -2
.gitignore
CHANGED
|
@@ -7,6 +7,10 @@ __pycache__/
|
|
| 7 |
*.so
|
| 8 |
|
| 9 |
abusive-relashionship-stories/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Distribution / packaging
|
| 12 |
.Python
|
|
|
|
| 7 |
*.so
|
| 8 |
|
| 9 |
abusive-relashionship-stories/
|
| 10 |
+
Abusive Relationship Stories - Technion & MSF.xlsx
|
| 11 |
+
Abusive Relationship Stories - Dataset Overview.docx
|
| 12 |
+
*.xlsx
|
| 13 |
+
*.docx
|
| 14 |
|
| 15 |
# Distribution / packaging
|
| 16 |
.Python
|
app.py
CHANGED
|
@@ -3,13 +3,14 @@ import subprocess
|
|
| 3 |
|
| 4 |
def run_training():
|
| 5 |
try:
|
| 6 |
-
# Run train.py using subprocess and capture output
|
| 7 |
result = subprocess.run(["python", "train_abuse_model.py"], capture_output=True, text=True)
|
| 8 |
-
|
|
|
|
| 9 |
return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
|
| 10 |
except Exception as e:
|
| 11 |
return f"Exception occurred:\n{str(e)}"
|
| 12 |
|
|
|
|
| 13 |
# Define a simple Gradio interface with one button
|
| 14 |
demo = gr.Interface(
|
| 15 |
fn=run_training,
|
|
|
|
| 3 |
|
| 4 |
def run_training():
|
| 5 |
try:
|
|
|
|
| 6 |
result = subprocess.run(["python", "train_abuse_model.py"], capture_output=True, text=True)
|
| 7 |
+
print("STDOUT:\n", result.stdout)
|
| 8 |
+
print("STDERR:\n", result.stderr)
|
| 9 |
return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
|
| 10 |
except Exception as e:
|
| 11 |
return f"Exception occurred:\n{str(e)}"
|
| 12 |
|
| 13 |
+
|
| 14 |
# Define a simple Gradio interface with one button
|
| 15 |
demo = gr.Interface(
|
| 16 |
fn=run_training,
|