Spaces:
Runtime error
Runtime error
Merge branch 'main' into milestone-2
Browse files- .github/workflows/sync_to_huggingface_hub.yml +20 -0
- app.py +0 -23
.github/workflows/sync_to_huggingface_hub.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v3
|
14 |
+
with:
|
15 |
+
fetch-depth: 0
|
16 |
+
lfs: true
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push --force https://joulammous:[email protected]/spaces/joulammous/Patent-Project main
|
app.py
CHANGED
@@ -1,24 +1 @@
|
|
1 |
|
2 |
-
# Libraries
|
3 |
-
|
4 |
-
import streamlit as st
|
5 |
-
import tensorflow as tf
|
6 |
-
from transformers import pipeline
|
7 |
-
|
8 |
-
# Milestone 2
|
9 |
-
|
10 |
-
sentiment_pipeline = pipeline("sentiment-analysis", model = "siebert/sentiment-roberta-large-english")
|
11 |
-
|
12 |
-
st.title('Sentiment Analysis with Hugging Face')
|
13 |
-
st.write('Enter some text and we will predict its sentiment!')
|
14 |
-
|
15 |
-
# Add a text input box for the user to enter text
|
16 |
-
text_input = st.text_input('Enter text here')
|
17 |
-
|
18 |
-
# When the user submits text, run the sentiment analysis model on it
|
19 |
-
if st.button('Submit'):
|
20 |
-
# Predict the sentiment of the text using the Hugging Face model
|
21 |
-
sentiment = sentiment_pipeline(text_input)[0]['label']
|
22 |
-
|
23 |
-
# Display the sentiment prediction to the user
|
24 |
-
st.write(f'Sentiment: {sentiment}')
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|