Tonic commited on
Commit
dca0c5c
Β·
unverified Β·
1 Parent(s): 7a526e2

fix display bug

Browse files
Files changed (1) hide show
  1. app.py +21 -16
app.py CHANGED
@@ -5,7 +5,7 @@ import os
5
  from transformers import AutoModelForCausalLM, AutoTokenizer
6
  import spaces
7
 
8
- title = """ # Welcome to Tonic's 🌊 Osmosis Structure - Text to JSON Converter
9
  """
10
  description = """
11
  Convert unstructured text into well-formatted JSON using the Osmosis Structure 0.6B model.
@@ -64,8 +64,9 @@ def load_model():
64
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
65
  device_map="auto" if torch.cuda.is_available() else None,
66
  trust_remote_code=True,
67
- token=hf_token
68
- )
 
69
 
70
  print("βœ… Osmosis Structure model loaded successfully!")
71
  return True
@@ -186,22 +187,26 @@ def text_to_json(input_text, max_tokens=512, temperature=0.6, top_p=0.95, top_k=
186
  except Exception as e:
187
  return f"❌ Error generating JSON: {str(e)}"
188
 
189
- # Create Gradio interface
190
  def create_demo():
 
191
  with gr.Blocks(
192
- title="Osmosis Structure - Text to JSON Converter",
193
- theme=gr.themes.Monochrome()
 
 
 
 
 
194
  ) as demo:
195
- with gr.Blocks(theme=gr.themes.Base()) as demo:
196
- with gr.Row():
197
- gr.Markdown(title)
198
- with gr.Row():
199
- with gr.Column(scale=1):
200
- with gr.Group():
201
- gr.Markdown(description)
202
- with gr.Column(scale=1):
203
- with gr.Group():
204
- gr.Markdown(joinus)
205
 
206
  with gr.Row():
207
  with gr.Column(scale=1):
 
5
  from transformers import AutoModelForCausalLM, AutoTokenizer
6
  import spaces
7
 
8
+ title = """ # πŸ™‹πŸ»β€β™‚οΈWelcome to 🌟Tonic's 🌊 Osmosis Structure - Text to JSON Converter
9
  """
10
  description = """
11
  Convert unstructured text into well-formatted JSON using the Osmosis Structure 0.6B model.
 
64
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
65
  device_map="auto" if torch.cuda.is_available() else None,
66
  trust_remote_code=True,
67
+ token=hf_token,
68
+ use_auth_token=hf_token # Backward compatibility
69
+ )
70
 
71
  print("βœ… Osmosis Structure model loaded successfully!")
72
  return True
 
187
  except Exception as e:
188
  return f"❌ Error generating JSON: {str(e)}"
189
 
 
190
  def create_demo():
191
+ # Fixed: Remove duplicate with gr.Blocks declaration
192
  with gr.Blocks(
193
+ title=title,
194
+ theme=gr.themes.Monochrome(),
195
+ css="""
196
+ .gradio-container {
197
+ max-width: 1200px !important;
198
+ }
199
+ """
200
  ) as demo:
201
+ # Header section
202
+ # gr.Markdown(title)
203
+
204
+ # Info section
205
+ with gr.Row():
206
+ with gr.Column(scale=1):
207
+ gr.Markdown(description)
208
+ with gr.Column(scale=1):
209
+ gr.Markdown(joinus)
 
210
 
211
  with gr.Row():
212
  with gr.Column(scale=1):