Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -114,6 +114,13 @@ def view_interactions():
|
|
114 |
else:
|
115 |
return "No interactions found."
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
# Create a Gradio interface to display interactions
|
118 |
view_interface = gr.Interface(
|
119 |
fn=view_interactions,
|
@@ -122,6 +129,14 @@ view_interface = gr.Interface(
|
|
122 |
title="View Interactions"
|
123 |
)
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
feedback_interface = gr.Interface(
|
126 |
fn=collect_feedback,
|
127 |
inputs=[
|
@@ -145,4 +160,5 @@ demo = gr.ChatInterface(
|
|
145 |
if __name__ == "__main__":
|
146 |
demo.launch()
|
147 |
feedback_interface.launch()
|
148 |
-
view_interface.launch()
|
|
|
|
114 |
else:
|
115 |
return "No interactions found."
|
116 |
|
117 |
+
def download_interactions():
|
118 |
+
"""Provide the interactions file for download"""
|
119 |
+
if os.path.exists(INTERACTIONS_FILE):
|
120 |
+
return INTERACTIONS_FILE
|
121 |
+
else:
|
122 |
+
return None
|
123 |
+
|
124 |
# Create a Gradio interface to display interactions
|
125 |
view_interface = gr.Interface(
|
126 |
fn=view_interactions,
|
|
|
129 |
title="View Interactions"
|
130 |
)
|
131 |
|
132 |
+
# Create a Gradio interface for downloading interactions
|
133 |
+
download_interface = gr.Interface(
|
134 |
+
fn=download_interactions,
|
135 |
+
inputs=[],
|
136 |
+
outputs=gr.File(label="Download Interactions"),
|
137 |
+
title="Download Interactions"
|
138 |
+
)
|
139 |
+
|
140 |
feedback_interface = gr.Interface(
|
141 |
fn=collect_feedback,
|
142 |
inputs=[
|
|
|
160 |
if __name__ == "__main__":
|
161 |
demo.launch()
|
162 |
feedback_interface.launch()
|
163 |
+
view_interface.launch()
|
164 |
+
download_interface.launch()
|