Spaces:
Running
Running
Merge branch 'main' of https://huggingface.co/spaces/raannakasturi/ReXploreBackend
Browse files- app.py +50 -40
- post_blog.py +3 -3
app.py
CHANGED
@@ -1,41 +1,51 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from main import post_blogpost
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
gr.themes.GoogleFont("
|
14 |
-
gr.themes.GoogleFont("Poppins"),
|
15 |
-
gr.themes.GoogleFont("Poppins")
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
<
|
24 |
-
""
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
app.queue(default_concurrency_limit=25).launch(show_api=True, show_error=True, debug=True)
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from main import post_blogpost
|
3 |
+
from post_blog import test
|
4 |
+
|
5 |
+
def clear_everything(title, category, summary, mindmap, citation, status, access_key):
|
6 |
+
return None, None, None, None, None, None, None
|
7 |
+
|
8 |
+
theme = gr.themes.Soft(
|
9 |
+
primary_hue="purple",
|
10 |
+
secondary_hue="cyan",
|
11 |
+
neutral_hue="slate",
|
12 |
+
font=[
|
13 |
+
gr.themes.GoogleFont("Syne"),
|
14 |
+
gr.themes.GoogleFont("Poppins"),
|
15 |
+
gr.themes.GoogleFont("Poppins"),
|
16 |
+
gr.themes.GoogleFont("Poppins")
|
17 |
+
],
|
18 |
+
)
|
19 |
+
|
20 |
+
with gr.Blocks(theme=theme, title="ReXplore Backend", fill_height=True) as app:
|
21 |
+
gr.HTML(
|
22 |
+
value ="""
|
23 |
+
<h1 style="text-align: center;">ReXplore Backend<p style="text-align: center;">Designed and Developed by <a href="https://raannakasturi.eu.org" target="_blank" rel="nofollow noreferrer external">Nayan Kasturi</a></p> </h1>
|
24 |
+
<p style="text-align: center;">Backend for ReXplore</p>
|
25 |
+
""")
|
26 |
+
with gr.Row():
|
27 |
+
with gr.Column():
|
28 |
+
access_key = gr.Textbox(label="Access Key", placeholder="Enter the Access Key", type="password")
|
29 |
+
start = gr.Button(value="Start", variant="primary")
|
30 |
+
test_btn = gr.Button(value="Test")
|
31 |
+
status = gr.Textbox(label="Data", placeholder="Enter the data", lines=7)
|
32 |
+
start.click(
|
33 |
+
post_blogpost,
|
34 |
+
inputs=[access_key],
|
35 |
+
outputs=[status],
|
36 |
+
concurrency_limit=25,
|
37 |
+
scroll_to_output=True,
|
38 |
+
show_api=True,
|
39 |
+
api_name="rexplore_backend",
|
40 |
+
show_progress="full",
|
41 |
+
)
|
42 |
+
test_btn.click(test,
|
43 |
+
inputs=[access_key],
|
44 |
+
outputs=[status],
|
45 |
+
concurrency_limit=25,
|
46 |
+
scroll_to_output=True,
|
47 |
+
show_api=True,
|
48 |
+
api_name="rexplore_backend_test",
|
49 |
+
show_progress="full",)
|
50 |
+
|
51 |
app.queue(default_concurrency_limit=25).launch(show_api=True, show_error=True, debug=True)
|
post_blog.py
CHANGED
@@ -8,9 +8,9 @@ import mistune
|
|
8 |
|
9 |
dotenv.load_dotenv()
|
10 |
access_key = os.getenv('ACCESS_KEY')
|
11 |
-
client_id = os.getenv('
|
12 |
-
client_secret = os.getenv('
|
13 |
-
refresh_token = os.getenv('
|
14 |
blog_id = os.getenv('BLOG_ID')
|
15 |
|
16 |
def extract_summary(text):
|
|
|
8 |
|
9 |
dotenv.load_dotenv()
|
10 |
access_key = os.getenv('ACCESS_KEY')
|
11 |
+
client_id = os.getenv('CLIENT_ID')
|
12 |
+
client_secret = os.getenv('CLIENT_SECRET')
|
13 |
+
refresh_token = os.getenv('REFRESH_TOKEN')
|
14 |
blog_id = os.getenv('BLOG_ID')
|
15 |
|
16 |
def extract_summary(text):
|