Spaces:
Build error
Build error
Commit
·
c525698
1
Parent(s):
d19fe76
Add application file
Browse files
app.py
CHANGED
|
@@ -21,3 +21,18 @@ language_identificator = load_model()
|
|
| 21 |
|
| 22 |
# Input Test from User
|
| 23 |
user_input = st.text_area("Enter some code to analyze",)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Input Test from User
|
| 23 |
user_input = st.text_area("Enter some code to analyze",)
|
| 24 |
+
|
| 25 |
+
#Identificate language
|
| 26 |
+
if st.button("Identificate Language")
|
| 27 |
+
print("button click")
|
| 28 |
+
if user_input.strip():
|
| 29 |
+
result = language_identificator(user_input)[0]
|
| 30 |
+
language = result['label']
|
| 31 |
+
score = result['score']
|
| 32 |
+
|
| 33 |
+
#Display the Result
|
| 34 |
+
st.subheader("Language Identification Result")
|
| 35 |
+
st.write(f"**Language:** {language}")
|
| 36 |
+
st.write(f"**Score:** {score:.2f}")
|
| 37 |
+
else:
|
| 38 |
+
st.warning("Please enter some code to analyze!")
|