app file updated
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import nltk
|
|
|
3 |
import pandas as pd
|
4 |
from nltk.tokenize import TreebankWordTokenizer
|
5 |
from sklearn.metrics.pairwise import cosine_similarity
|
@@ -271,5 +272,10 @@ def main_interface():
|
|
271 |
|
272 |
# Launch the Gradio interface
|
273 |
if __name__ == "__main__":
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import nltk
|
3 |
+
import os
|
4 |
import pandas as pd
|
5 |
from nltk.tokenize import TreebankWordTokenizer
|
6 |
from sklearn.metrics.pairwise import cosine_similarity
|
|
|
272 |
|
273 |
# Launch the Gradio interface
|
274 |
if __name__ == "__main__":
|
275 |
+
# Check if running in Hugging Face Spaces
|
276 |
+
if "HF_SPACE" in os.environ:
|
277 |
+
interface = main_interface()
|
278 |
+
# In Spaces, we don't call launch() as the platform handles the server
|
279 |
+
else:
|
280 |
+
interface = main_interface()
|
281 |
+
interface.launch(share=False) # Set share=True for local public URL
|