File size: 965 Bytes
91a6027
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c728805
91a6027
c728805
91a6027
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests
import streamlit as st
import time 
from transformers import pipeline
import os
from .utils import query

HF_AUTH_TOKEN = os.getenv('HF_AUTH_TOKEN')
headers = {"Authorization": f"Bearer {HF_AUTH_TOKEN}"}

def write():

	st.markdown("# Natural Language Inference")
	st.sidebar.header("Natural Language Inference")
	st.write(
		"""Here, you can perform Natural Language Inference using the fine-tuned TURNA NLI model. """
	)
	
	hypothesis = st.text_area(label='Hypothesis: ', height=50, 
			value="Temple Bar'da çok sanatçı var.")
	premise = st.text_area(label='Premise: ', height=50, 
			value="Temple Bar herhangi bir müzisyen veya sanatçıdan tamamen yoksundur.")
	url = ("https://api-inference.huggingface.co/models/boun-tabi-LMG/turna_nli_nli_tr")
	params = {"max_new_tokens": 8 }
	if st.button("Generate"):
		with st.spinner('Generating...'):
			output = query(f"hipotez: {hypothesis} önerme: {premise}", url, params)
			st.success(output)