sylvain471 commited on
Commit
6224e41
·
verified ·
1 Parent(s): e092640

Upload 7 files

Browse files
Files changed (3) hide show
  1. app.py +33 -9
  2. dashboard.png +0 -0
  3. login.png +0 -0
app.py CHANGED
@@ -32,27 +32,51 @@ def fetch_timetable(date:str='today') -> str:
32
  return get_timetable()
33
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  with gr.Blocks() as demo:
37
 
38
  # Add title and markdown
39
  with gr.Row():
40
- gr.Markdown("""## Fake App Dashboard
41
- Use playwright to scrape homework and timetable from [fake-app-omega.vercel.app](https://fake-app-omega.vercel.app)
42
- """)
43
 
44
- with gr.Row():
45
- date = gr.Textbox(label="date",visible=False)
46
-
47
  with gr.Row():
48
  with gr.Column():
49
  homeworks_btn = gr.Button("Homeworks")
50
- homeworks_output = gr.Textbox(label="Homeworks Result", lines=10)
51
 
52
  with gr.Column():
53
  timetable_btn = gr.Button("Timetable")
54
- timetable_output = gr.Textbox(label="Timetable Result", lines=10)
 
 
 
55
 
 
 
 
56
 
57
  homeworks_btn.click(fn=fetch_homework,
58
  inputs=[date],
@@ -63,4 +87,4 @@ with gr.Blocks() as demo:
63
  inputs=[date],
64
  outputs=timetable_output)
65
 
66
- demo.launch(mcp_server=True)
 
32
  return get_timetable()
33
 
34
 
35
+ title="<h2>Gradio MCP Hackathon: fake-app-scraper</h2>"
36
+ description="""<div style="font-family: sans-serif; line-height: 1.6;">
37
+ <p>
38
+ This app uses Playwright to log in and scrape the content of the dashboard of the fake app
39
+ <a href="https://fake-app-omega.vercel.app" target="_blank">fake-app-omega.vercel.app</a>.
40
+ </p>
41
+ <p>
42
+ The starting point was to provide an LLM-friendly, API-fied version of a real app that does not provide any API. Used as an MCP server, any user of the app could simply ask their AI assistant to fetch information from their dashboard.
43
+ </p>
44
+ <h3>Problem</h3>
45
+ <p>
46
+ When run locally, the app can take the credentials as environment variables to log into the user's dashboard. However, when hosted as a Hugging Face Space, I couldn't find a way to send the credentials securely—i.e., without explicitly providing them to the LLM.
47
+ </p>
48
+ <p>
49
+ In conclusion, as it stands, this app together with the fake Next.js app only serves demonstration or educational purposes and does not solve a real-life problem.
50
+ </p>
51
+ <p><strong>I’d be happy to get any suggestions on how to send credentials in the context of a Gradio HF Space–hosted app.</strong></p>
52
+ </div>
53
+ """
54
+
55
+ images="""<img src="gradio_api/file=login.png" alt="login" style="max-width: 35%; margin-right: 10px;" />
56
+ <img src="gradio_api/file=dashboard.png" alt="dashboard" style="max-width: 35%;" />
57
+ """
58
 
59
  with gr.Blocks() as demo:
60
 
61
  # Add title and markdown
62
  with gr.Row():
63
+ gr.HTML(title)
 
 
64
 
 
 
 
65
  with gr.Row():
66
  with gr.Column():
67
  homeworks_btn = gr.Button("Homeworks")
68
+ homeworks_output = gr.Textbox(label="Homeworks Result", lines=5)
69
 
70
  with gr.Column():
71
  timetable_btn = gr.Button("Timetable")
72
+ timetable_output = gr.Textbox(label="Timetable Result", lines=5)
73
+
74
+ with gr.Row():
75
+ date = gr.Textbox(label="date",visible=False)
76
 
77
+ with gr.Row():
78
+ gr.HTML(description)
79
+ gr.HTML(images)
80
 
81
  homeworks_btn.click(fn=fetch_homework,
82
  inputs=[date],
 
87
  inputs=[date],
88
  outputs=timetable_output)
89
 
90
+ demo.launch(mcp_server=True,allowed_paths=["/"])
dashboard.png ADDED
login.png ADDED