Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -195,30 +195,21 @@ inputs = [
|
|
| 195 |
gr.Image(type="pil", label="Upload Image")
|
| 196 |
]
|
| 197 |
|
|
|
|
| 198 |
tracking_id = os.environ.get('TRACKING_ID')
|
| 199 |
if tracking_id is None:
|
| 200 |
raise ValueError("No tracking_id key found. Please set the 'tracking_id' environment variable.")
|
| 201 |
|
| 202 |
-
|
| 203 |
-
# Create the Gradio interface output
|
| 204 |
-
outputs = gr.Markdown(label="Result")
|
| 205 |
-
|
| 206 |
-
# Define the footer HTML with Font Awesome icons and Google Analytics
|
| 207 |
footer_html_with_analytics = """
|
| 208 |
-
<!-- Google Analytics -->
|
| 209 |
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TRACKING_ID"></script>
|
| 210 |
<script>
|
| 211 |
window.dataLayer = window.dataLayer || [];
|
| 212 |
function gtag(){dataLayer.push(arguments);}
|
| 213 |
gtag('js', new Date());
|
| 214 |
-
|
| 215 |
gtag('config', 'YOUR_TRACKING_ID');
|
| 216 |
</script>
|
| 217 |
-
<!-- End Google Analytics -->
|
| 218 |
-
|
| 219 |
-
<!-- Font Awesome -->
|
| 220 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 221 |
-
|
| 222 |
<div style='text-align: center; margin-top: 20px;'>
|
| 223 |
<p>Developed by Hossein Mohseni</p>
|
| 224 |
<p>Contact Information:</p>
|
|
@@ -235,14 +226,14 @@ footer_html_with_analytics = """
|
|
| 235 |
</p>
|
| 236 |
<p>This application is a demonstration. To enhance and improve it, your feedback is highly appreciated.</p>
|
| 237 |
</div>
|
| 238 |
-
"""
|
| 239 |
|
| 240 |
-
|
| 241 |
-
footer_html_with_analytics = footer_html_with_analytics.replace("YOUR_TRACKING_ID", tracking_id)
|
| 242 |
|
| 243 |
-
#
|
| 244 |
with gr.Blocks() as demo:
|
| 245 |
-
gr.
|
|
|
|
| 246 |
gr.HTML(footer_html_with_analytics)
|
| 247 |
|
| 248 |
# Launch the interface
|
|
|
|
| 195 |
gr.Image(type="pil", label="Upload Image")
|
| 196 |
]
|
| 197 |
|
| 198 |
+
# Ensure TRACKING_ID is set in the environment
|
| 199 |
tracking_id = os.environ.get('TRACKING_ID')
|
| 200 |
if tracking_id is None:
|
| 201 |
raise ValueError("No tracking_id key found. Please set the 'tracking_id' environment variable.")
|
| 202 |
|
| 203 |
+
# Replace YOUR_TRACKING_ID with the actual Google Analytics tracking ID
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
footer_html_with_analytics = """
|
|
|
|
| 205 |
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TRACKING_ID"></script>
|
| 206 |
<script>
|
| 207 |
window.dataLayer = window.dataLayer || [];
|
| 208 |
function gtag(){dataLayer.push(arguments);}
|
| 209 |
gtag('js', new Date());
|
|
|
|
| 210 |
gtag('config', 'YOUR_TRACKING_ID');
|
| 211 |
</script>
|
|
|
|
|
|
|
|
|
|
| 212 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
|
|
|
| 213 |
<div style='text-align: center; margin-top: 20px;'>
|
| 214 |
<p>Developed by Hossein Mohseni</p>
|
| 215 |
<p>Contact Information:</p>
|
|
|
|
| 226 |
</p>
|
| 227 |
<p>This application is a demonstration. To enhance and improve it, your feedback is highly appreciated.</p>
|
| 228 |
</div>
|
| 229 |
+
""".replace("YOUR_TRACKING_ID", tracking_id)
|
| 230 |
|
| 231 |
+
outputs = gr.Markdown(label="Result")
|
|
|
|
| 232 |
|
| 233 |
+
# Define the Gradio Blocks and Interface
|
| 234 |
with gr.Blocks() as demo:
|
| 235 |
+
gr.Markdown("# IELTS Writing Evaluation")
|
| 236 |
+
gr.Interface(fn=evaluate, inputs=inputs, outputs=outputs)
|
| 237 |
gr.HTML(footer_html_with_analytics)
|
| 238 |
|
| 239 |
# Launch the interface
|