Spaces:
Runtime error
Runtime error
Sunil Surendra Singh
commited on
Commit
·
0135459
1
Parent(s):
0007e34
accessing secrets via getenv
Browse files- README.md +13 -1
- streamlit/src/data.py +2 -1
- streamlit/src/tab_paraphraser.py +2 -1
README.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
<img src="https://github.com/sssingh/nlp-text-paraphraser-gpt/blob/main/streamlit/assets/title.png?raw=true" width="1000" height="350"/><br><br>
|
4 |
|
|
|
1 |
+
---
|
2 |
+
title: Nlp Text Paraphraser Gpt
|
3 |
+
emoji: 📝
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: red
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.27.1
|
8 |
+
app_file: streamlit/src/app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
---
|
12 |
+
|
13 |
+
<a href="https://huggingface.co/spaces/sssingh/nlp-text-paraphraser-gpt" target="_blank"><img src="https://img.shields.io/badge/click_here_to_open_streamlit_app-f63366?style=for-the-badge&logo=streamlit&logoColor=black" /></a>
|
14 |
|
15 |
<img src="https://github.com/sssingh/nlp-text-paraphraser-gpt/blob/main/streamlit/assets/title.png?raw=true" width="1000" height="350"/><br><br>
|
16 |
|
streamlit/src/data.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
"""All app-specific data and disk-IO related functionality implemented here"""
|
2 |
|
|
|
3 |
import pymongo
|
4 |
import streamlit as st
|
5 |
|
@@ -7,7 +8,7 @@ import streamlit as st
|
|
7 |
@st.cache_resource
|
8 |
def __get_db():
|
9 |
"""Connect to MongoDB Atlas instances"""
|
10 |
-
client = pymongo.MongoClient(
|
11 |
return client
|
12 |
|
13 |
|
|
|
1 |
"""All app-specific data and disk-IO related functionality implemented here"""
|
2 |
|
3 |
+
import os
|
4 |
import pymongo
|
5 |
import streamlit as st
|
6 |
|
|
|
8 |
@st.cache_resource
|
9 |
def __get_db():
|
10 |
"""Connect to MongoDB Atlas instances"""
|
11 |
+
client = pymongo.MongoClient(os.getenv("MONGO_CONN_STR"))
|
12 |
return client
|
13 |
|
14 |
|
streamlit/src/tab_paraphraser.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
"""About tab rendering functionality"""
|
2 |
|
|
|
3 |
from config import app_config
|
4 |
import data
|
5 |
import requests
|
@@ -11,7 +12,7 @@ import streamlit as st
|
|
11 |
###
|
12 |
def __paraphrase(text):
|
13 |
### Invoke the lambda function via REST api call to paraphrase the text
|
14 |
-
url =
|
15 |
headers = {"Content-Type": "application/json"}
|
16 |
payload = {"text": text}
|
17 |
response = requests.request(method="POST", url=url, headers=headers, json=payload)
|
|
|
1 |
"""About tab rendering functionality"""
|
2 |
|
3 |
+
import os
|
4 |
from config import app_config
|
5 |
import data
|
6 |
import requests
|
|
|
12 |
###
|
13 |
def __paraphrase(text):
|
14 |
### Invoke the lambda function via REST api call to paraphrase the text
|
15 |
+
url = os.getenv("API_ENDPOINT")
|
16 |
headers = {"Content-Type": "application/json"}
|
17 |
payload = {"text": text}
|
18 |
response = requests.request(method="POST", url=url, headers=headers, json=payload)
|