Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -195,7 +195,55 @@ inputs = [
|
|
195 |
gr.Image(type="pil", label="Upload Image")
|
196 |
]
|
197 |
|
|
|
|
|
|
|
198 |
|
|
|
|
|
199 |
outputs = gr.Markdown(label="Result")
|
200 |
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
225 |
+
<p>
|
226 |
+
<a href='mailto:[email protected]' style='margin-right: 10px;'>
|
227 |
+
<i class='fas fa-envelope'></i>
|
228 |
+
</a>
|
229 |
+
<a href='https://www.linkedin.com/in/mohsenihossein/' target='_blank' style='margin-right: 10px;'>
|
230 |
+
<i class='fab fa-linkedin'></i>
|
231 |
+
</a>
|
232 |
+
<a href='https://t.me/mohsenih1999' target='_blank'>
|
233 |
+
<i class='fab fa-telegram'></i>
|
234 |
+
</a>
|
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 |
+
# Replace YOUR_TRACKING_ID with your actual Google Analytics tracking ID
|
241 |
+
footer_html_with_analytics = footer_html_with_analytics.replace("YOUR_TRACKING_ID", tracking_id)
|
242 |
+
|
243 |
+
# Create the Gradio interface
|
244 |
+
with gr.Blocks() as demo:
|
245 |
+
gr.Interface(fn=evaluate, inputs=inputs, outputs=outputs, title="IELTS Writing Evaluation").launch(share=True, debug=True)
|
246 |
+
gr.HTML(footer_html_with_analytics)
|
247 |
+
|
248 |
+
# Launch the interface
|
249 |
+
demo.launch(share=True, debug=True)
|