srihariEmids commited on
Commit
e4b071e
·
verified ·
1 Parent(s): 8234fdf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import load_dataset
2
+ import streamlit as st
3
+ from huggingface_hub import hf_hub_download
4
+ import gzip
5
+ import json
6
+
7
+ @st.cache(allow_output_mutation=True)
8
+ def get_model():
9
+ model_id = "srihariEmids/emidsinfo-fine-tune-llamamodel"
10
+ model = hf_hub_download(model_id, library_name="transformers")
11
+ return model
12
+
13
+ def predict(text):
14
+ model = get_model()
15
+ inputs = model.prepare_inputs_for_generation(text, max_length=512, return_tensors="pt")
16
+ outputs = model.generate(**inputs)
17
+ return outputs
18
+
19
+ def main():
20
+ text = st.text_input("Enter text to analyze:")
21
+ prediction = predict(text)
22
+ st.write(prediction)
23
+
24
+ if __name__ == "__main__":
25
+ main()