Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -117,7 +117,7 @@ def create_ui():
|
|
117 |
with gr.Row():
|
118 |
with gr.Column(scale=1):
|
119 |
space_list = gr.List(
|
120 |
-
[f"{space['name']} by {space['author']} (Likes: {space['likes']})" for space in formatted_spaces],
|
121 |
label="Most Liked Spaces"
|
122 |
)
|
123 |
summarize_btn = gr.Button("์์ฝ")
|
@@ -130,16 +130,16 @@ def create_ui():
|
|
130 |
global selected_space_info
|
131 |
try:
|
132 |
print(f"Selection event: {evt}") # ๋๋ฒ๊น
์ถ๋ ฅ
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
selected_space_info = selected_space
|
137 |
-
app_content = get_app_py_content(
|
138 |
-
print(f"Selected space: {selected_space['name']} (ID: {
|
139 |
-
return f"์ ํ๋ Space: {selected_space['name']} (ID: {
|
140 |
else:
|
141 |
-
print(f"
|
142 |
-
return "
|
143 |
except Exception as e:
|
144 |
print(f"Error in on_select: {str(e)}")
|
145 |
print(traceback.format_exc()) # ์์ธํ ์ค๋ฅ ์ ๋ณด ์ถ๋ ฅ
|
|
|
117 |
with gr.Row():
|
118 |
with gr.Column(scale=1):
|
119 |
space_list = gr.List(
|
120 |
+
[(f"{space['name']} by {space['author']} (Likes: {space['likes']})", space['id']) for space in formatted_spaces],
|
121 |
label="Most Liked Spaces"
|
122 |
)
|
123 |
summarize_btn = gr.Button("์์ฝ")
|
|
|
130 |
global selected_space_info
|
131 |
try:
|
132 |
print(f"Selection event: {evt}") # ๋๋ฒ๊น
์ถ๋ ฅ
|
133 |
+
selected_id = evt.value[1] # ํํ์ ๋ ๋ฒ์งธ ์์๊ฐ space_id์
๋๋ค.
|
134 |
+
selected_space = next((space for space in formatted_spaces if space['id'] == selected_id), None)
|
135 |
+
if selected_space:
|
136 |
selected_space_info = selected_space
|
137 |
+
app_content = get_app_py_content(selected_id)
|
138 |
+
print(f"Selected space: {selected_space['name']} (ID: {selected_id})") # ๋๋ฒ๊น
์ถ๋ ฅ
|
139 |
+
return f"์ ํ๋ Space: {selected_space['name']} (ID: {selected_id})\nURL: {selected_space['url']}", app_content
|
140 |
else:
|
141 |
+
print(f"Space not found for ID: {selected_id}") # ๋๋ฒ๊น
์ถ๋ ฅ
|
142 |
+
return "์ ํ๋ space๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.", ""
|
143 |
except Exception as e:
|
144 |
print(f"Error in on_select: {str(e)}")
|
145 |
print(traceback.format_exc()) # ์์ธํ ์ค๋ฅ ์ ๋ณด ์ถ๋ ฅ
|