parass13 commited on
Commit
fa4be61
Β·
verified Β·
1 Parent(s): d90562a

Update pages/community.py

Browse files
Files changed (1) hide show
  1. pages/community.py +45 -15
pages/community.py CHANGED
@@ -1,22 +1,52 @@
1
  import gradio as gr
 
 
2
 
3
- def layout():
4
- gr.Markdown("## 🌐 Join the Community")
 
 
 
 
 
 
 
5
 
6
- gr.Markdown("""
7
- Deepfakes are becoming increasingly sophisticated. We believe that fighting misinformation is a community effort.
 
 
 
 
 
 
 
 
8
 
9
- ### 🀝 How You Can Contribute
10
- - **Share your feedback** on the tool’s performance
11
- - **Report suspicious media** or share verified datasets
12
- - **Suggest improvements** to the detection model
13
- - **Educate others** on recognizing and avoiding deepfake scams
14
 
15
- ### πŸ’¬ Let’s Talk
16
- Join our open discussions and connect with developers, researchers, and digital safety advocates.
17
- Whether you're a student, developer, or just curious β€” your voice matters.
 
 
 
 
 
 
 
 
 
18
 
19
- ### πŸ“¬ Get in Touch
20
- - πŸ“§ Email: [email protected]
 
 
 
 
21
 
22
- """)
 
1
  import gradio as gr
2
+ import requests
3
+ import json
4
 
5
+ SUPABASE_URL = "https://fpbuhzbdtzwomjwytqul.supabase.co"
6
+ SUPABASE_API_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZwYnVoemJkdHp3b21qd3l0cXVsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTE5NDk3NzYsImV4cCI6MjA2NzUyNTc3Nn0.oAa2TNNPQMyOGk63AOMZ7XKcwYvy5m-xoSWyvMZd6FY"
7
+ SUPABASE_FEEDBACK_TABLE = "feedback"
8
+
9
+ headers = {
10
+ "apikey": SUPABASE_API_KEY,
11
+ "Authorization": f"Bearer {SUPABASE_API_KEY}",
12
+ "Content-Type": "application/json"
13
+ }
14
 
15
+ def submit_feedback(name, email, rating, comments):
16
+ if not all([name, email, rating, comments]):
17
+ return "❌ Please fill in all fields before submitting."
18
+
19
+ data = {
20
+ "name": name,
21
+ "email": email,
22
+ "rating": int(rating),
23
+ "comments": comments
24
+ }
25
 
26
+ response = requests.post(
27
+ f"{SUPABASE_URL}/rest/v1/{SUPABASE_FEEDBACK_TABLE}",
28
+ headers=headers,
29
+ data=json.dumps(data)
30
+ )
31
 
32
+ if response.status_code == 201:
33
+ return "βœ… Thank you for your feedback!"
34
+ else:
35
+ return f"❌ Failed to submit feedback. Error: {response.text}"
36
+
37
+ def layout():
38
+ with gr.Column():
39
+ gr.Markdown("## 🌐 Community & Feedback")
40
+ gr.Markdown("""
41
+ Welcome to the VerifiAI community hub!
42
+ We'd love to hear your feedback to improve this tool.
43
+ """)
44
 
45
+ name = gr.Textbox(label="Your Name")
46
+ email = gr.Textbox(label="Email")
47
+ rating = gr.Slider(minimum=1, maximum=5, step=1, label="Rating (1 to 5)")
48
+ comments = gr.Textbox(label="Your Comments", lines=4, placeholder="What do you like? What can be improved?")
49
+ submit_btn = gr.Button("Submit Feedback", variant="primary")
50
+ status = gr.Textbox(label="Submission Status", interactive=False)
51
 
52
+ submit_btn.click(fn=submit_feedback, inputs=[name, email, rating, comments], outputs=status)