Spaces:
Sleeping
Sleeping
Commit
·
0c1d006
1
Parent(s):
e0f6cd1
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,8 @@ from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampl
|
|
13 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
14 |
import gradio as gr
|
15 |
|
|
|
|
|
16 |
def greet(co):
|
17 |
code_text = []
|
18 |
|
@@ -224,6 +226,7 @@ with gr.Blocks() as demo1:
|
|
224 |
with gr.Column():
|
225 |
outputs_1 = gr.Text(label = 'Result')
|
226 |
btn.click(fn = greet, inputs = inputs_1, outputs= outputs_1)
|
|
|
227 |
|
228 |
if __name__ == "__main__":
|
229 |
demo1.launch()
|
|
|
13 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
14 |
import gradio as gr
|
15 |
|
16 |
+
examples = 'static int\nFax3SetupState(TIFF* tif)\n{\n\tstatic const char module[] = "Fax3SetupState";\n\tTIFFDirectory* td = &tif->tif_dir;\n\tFax3BaseState* sp = Fax3State(tif);\n\tint needsRefLine;\n\tFax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);\n\ttmsize_t rowbytes;\n\tuint32 rowpixels, nruns;\n\n\tif (td->td_bitspersample != 1) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t "Bits/sample must be 1 for Group 3/4 encoding/decoding");\n\t\treturn (0);\n\t}\n\t/*\n\t * Calculate the scanline/tile widths.\n\t */\n\tif (isTiled(tif)) {\n\t\trowbytes = TIFFTileRowSize(tif);\n\t\trowpixels = td->td_tilewidth;\n\t} else {\n\t\trowbytes = TIFFScanlineSize(tif);\n\t\trowpixels = td->td_imagewidth;\n\t}\n\tsp->rowbytes = rowbytes;\n\tsp->rowpixels = rowpixels;\n\t/*\n\t * Allocate any additional space required for decoding/encoding.\n\t */\n\tneedsRefLine = (\n\t (sp->groupoptions & GROUP3OPT_2DENCODING) ||\n\t td->td_compression == COMPRESSION_CCITTFAX4\n\t);\n\n\tnruns = needsRefLine ? 2*TIFFroundup_32(rowpixels,32) : rowpixels;\n\tnruns += 3;\n\tdsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns, sizeof (uint32),\n\t\t\t\t\t "for Group 3/4 run arrays");\n\tif (dsp->runs == NULL)\n\t\treturn (0);\n\tdsp->curruns = dsp->runs;\n\tif (needsRefLine)\n\t\tdsp->refruns = dsp->runs + nruns;\n\telse\n\t\tdsp->refruns = NULL;\n\tif (td->td_compression == COMPRESSION_CCITTFAX3\n\t && is2DEncoding(dsp)) {\t/* NB: default is 1D routine */\n\t\ttif->tif_decoderow = Fax3Decode2D;\n\t\ttif->tif_decodestrip = Fax3Decode2D;\n\t\ttif->tif_decodetile = Fax3Decode2D;\n\t}\n\n\tif (needsRefLine) {\t\t/* 2d encoding */\n\t\tFax3CodecState* esp = EncoderState(tif);\n\t\t/*\n\t\t * 2d encoding requires a scanline\n\t\t * buffer for the ``reference line\'\'; the\n\t\t * scanline against which delta encoding\n\t\t * is referenced. The reference line must\n\t\t * be initialized to be ``white\'\' (done elsewhere).\n\t\t */\n\t\tesp->refline = (unsigned char*) _TIFFmalloc(rowbytes);\n\t\tif (esp->refline == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t "No space for Group 3/4 reference line");\n\t\t\treturn (0);\n\t\t}\n\t} else\t\t\t\t\t/* 1d encoding */\n\t\tEncoderState(tif)->refline = NULL;\n\n\treturn (1);\n}'
|
17 |
+
|
18 |
def greet(co):
|
19 |
code_text = []
|
20 |
|
|
|
226 |
with gr.Column():
|
227 |
outputs_1 = gr.Text(label = 'Result')
|
228 |
btn.click(fn = greet, inputs = inputs_1, outputs= outputs_1)
|
229 |
+
gr.Examples(examples, inputs = inputs_1)
|
230 |
|
231 |
if __name__ == "__main__":
|
232 |
demo1.launch()
|